package com.hspedu.properties;

import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;

/**
 * @author 谷其昊
 * @version 1.0
 * @date 2022/2/26
 * @time 18:31
 */
public class Properties02 {
    public static void main(String[] args) throws IOException {
        //1.创建对象
        Properties properties = new Properties();
        //2.加载文件
        properties.load(new FileReader("D:\\workspace_idea\\java0\\hspedu\\chapter19\\src\\mysql.properties"));
        //3.把键值对显示到控制台
        properties.list(System.out);

        System.out.println();

        String user = properties.getProperty("user");
        String pwd = properties.getProperty("pwd");
        System.out.println("用户名是："+user+"\n密码是："+pwd);

    }
}
